package tets;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-24
 * Time: 8:29
 */

class Student1{
    private String name;
    private int age;
    private String sex;
    public static String school;

    public static void doHomeWork(){
        System.out.println("写作业");
    }

    public void eat(){
        {
            System.out.println("略略略");
        }
        System.out.println("吃饭");
    }

    public static void doClass(){
        this.eat();//错，eat为非静态方法
        Student1.doHomeWork();//对，doHomeWork是静态方法
        System.out.println(school);//对，school是静态成员变量
        System.out.println(name);//错，name不是静态成员变量
    }

}

class Student{
    private String name;
    private int age;

    {
        this.name = "张三";
        this.age = 10;
    }

    static {
        System.out.println("略略略");
    }

}

public class Test {
}
